Repository navigation
Replace KeyboardShortcuts with our own global shortcuts - #13
Merged
Merged
Conversation
Removes the only third-party dependency. - BlotterKit: KeyCombo (key code and modifiers, Carbon conversion, symbols, validity, Blotter 2 conversion) and HotkeyAction, with tests. - HotkeyCenter registers shortcuts with Carbon's RegisterEventHotKey, the only API that delivers system-wide shortcuts to a sandboxed app without Accessibility access, and pauses them while one is recorded. - HotkeyStore persists them as JSON in user defaults and checks for missing modifiers, conflicts with other actions and shortcuts macOS reserves. - KeyDisplay names keys for the current keyboard layout (UCKeyTranslate) and builds menu key equivalents. - ShortcutRecorder replaces the recorder in Settings: click, press the shortcut; Escape cancels and Delete clears. - The Blotter 2 migration writes into the new store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes KeyboardShortcuts, Blotter's only third-party dependency, and replaces it with a small implementation of our own. The behaviour is the same: six optional global shortcuts, recorded in Settings › Shortcuts and shown in the menu bar menu.
How it works
KeyComboandHotkeyAction(BlotterKit, tested): a key code plus modifiers. Handles conversion to Carbon modifiers, the ⌃⌥⇧⌘ symbols, validity (⌘, ⌥ or ⌃ is required, except for F-keys), names for special keys, conflicts between actions, and converting Blotter 2's ShortcutRecorder values.HotkeyCenter: registers shortcuts with Carbon'sRegisterEventHotKey, the same API KeyboardShortcuts used underneath. It's the only one that delivers system-wide shortcuts to a sandboxed app without asking for Accessibility access. Registration failures, e.g. a shortcut already taken by another app, are logged. Shortcuts are paused while one is being recorded, so pressing an existing one records it instead of firing it.HotkeyStore: keeps shortcuts as JSON in user defaults underHotkey.<action>. Before a shortcut is assigned it checks for missing modifiers, conflicts with another Blotter action, and shortcuts macOS reserves (CopySymbolicHotKeys).KeyDisplay: shows a key as it appears on the current keyboard layout (UCKeyTranslate). It falls back to an ASCII-capable layout for input methods without one, and buildsNSMenuItemkey equivalents.ShortcutRecorder: a SwiftUI field. Click it, then press the shortcut; Escape cancels and Delete clears. There is a clear button, inline error messages and VoiceOver labels.HotkeyStore.Housekeeping
Package.resolvedis gone, since there are no remote packages left.-BlotterSettingsPane <n>opens a given pane at launch.KeyCombo.HotkeyStorepersistence, validation, and 2.x shortcut migration.No data migration is needed for 3.0 users, because 3.0 hasn't shipped.
Not verifiable on CI
Pressing a global shortcut and recording one with the keyboard can't be done on CI. The same goes for how keys display on non-US layouts. Please check these on a Mac.
🤖 Generated with Claude Code